program Pi2;

{$APPTYPE CONSOLE}

uses
  SysUtils;

var
x, y, p: real;
i, n0, n: integer;
fout: textfile;

begin
  randomize;
  n:=0;
  n0:=0;
  assignfile(fout, 'output.txt');
  rewrite(fout);
  for i:=1 to 2000000000 do
  begin
    x:=2*random;
    y:=2*random;
    if ((x-1)*(x-1)+(y-1)*(y-1)<1) then
      n0:=n0+1;
    n:=n+1;
    if (i mod 62500 =0) then
    begin
      p:= Pi-4*(n0/n);
      writeln (fout, n, ' ,', p:0:9 );
    end;
  end;
  closefile(fout);
end.
